//
//  CalcTree2.h
//  抽象二叉树
//
//  Created by chenyh on 2021/1/27.
//

#ifndef CalcTree2_h
#define CalcTree2_h

#include <stdio.h>

typedef struct _NodeVTable NodeVTable;
typedef struct _Node{
    const NodeVTable *vtable;
}Node;

typedef struct _BinNode{
    Node isa;
    Node *p_Left;
    Node *p_Right;
}BinNode;

typedef struct _NumNode {
    Node isa;
    double _num;
}NumNode;
typedef struct _AddNode {
    Node isa;
    Node *_pLeft;
    Node *_pRight;
}AddNode;
typedef struct _MultNode {
    Node isa;
    Node *_pLeft;
    Node *_pRight;
}MultNode;

double node_calc(Node *pThis);
void node_cleanup(Node *pThis);
NumNode *newNumNode(double num);
AddNode *newAddNode(Node *pLeft,Node *pRight);
MultNode *newMultNode(Node *pLeft,Node *pRight);
#endif /* CalcTree2_h */
